package com.inexas.cu.client.register;

import com.google.gwt.user.client.ui.*;
import com.google.inject.*;
import com.inexas.cu.client.mvp.*;

public class RegisterView extends Composite implements View<RegisterPm> {
	private final Grid grid = new Grid(6, 2);
	private final TextBox firstNameTextBox = new TextBox();
	private final TextBox lastNameTextBox = new TextBox();
	private final TextBox accountNameTextBox = new TextBox();
	private final TextBox passwordTextBox = new PasswordTextBox();
	private final Button signInButton = new Button("Sign in");
	private final Button signOutButton = new Button("Sign out");
	private final Button registerButton = new Button("Register");
	private final Button deregisterButton = new Button("Delete this registration");
	private final Label messageLabel = new Label();

	@Inject
	public RegisterView() {
		grid.setText(0, 0, "Account name");
		grid.setWidget(0, 1, accountNameTextBox);
		
		grid.setText(1, 0, "Password");
		grid.setWidget(1, 1, passwordTextBox);
		
		grid.setWidget(2, 0, signInButton);
		grid.setWidget(2, 1, signOutButton);
		
		grid.setText(3, 0, "First name");
		grid.setWidget(3, 1, firstNameTextBox);
		
		grid.setText(4, 0, "Last name");
		grid.setWidget(4, 1, lastNameTextBox);
		
		grid.setWidget(5, 0, registerButton);
		grid.setWidget(5, 1, deregisterButton);
		
		final VerticalPanel vp = new VerticalPanel();
		vp.add(grid);
		vp.add(messageLabel);
		initWidget(vp);
	}

	public void bind(RegisterPm pm) {
	    // !todo Implement me
	    throw new RuntimeException("How about implementing me?!");
    }

}
